<?php
    function get_url_data($url) {
        ini_set("max_execution_time", 100);
        $curl = curl_init();

        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_URL , $url);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 90);
        curl_setopt($curl, CURLOPT_TIMEOUT, 90);

        $res = curl_exec($curl);
        curl_close($curl);

        return $res;
    }

    function post_url_data($url, $params) {
        ini_set("max_execution_time", 100);
        $curl = curl_init();

        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_URL, $url);
        //curl_setopt($curl, CURLOPT_HEADER, 1);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
        
        $res = curl_exec($curl);
        curl_close($curl);

        return $res;
    }
?>